StringScanner.Replace Function

Syntax

Replace as v(text as c[,delete as n])

Arguments

text

The new text to insert into the buffer at the current offset.

delete

Optional. Default = 0. The number of characters in the buffer to replace.

Description

Replace text at current position (delete # of bytes).

Discussion

The <StringScanner>.Replace() function inserts and optionally replaces text in the buffer. The offset is positioned immediately after the replaced text.

Example

dim scanner as P
dim txt as C
txt = <<%text%
This is wonderful prose written
by a technical writer of note.
%text%
? txt
= This is wonderful prose written
by a technical writer of note.
scanner = stringscanner.create(txt)
scanner.scanover(8)
scanner.replace("magnificent", 9)
? scanner.GetToOffset()
= "This is magnificent"
? scanner.GetRemainder()
=prose written
by a technical writer of note.

See Also